<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<link href="/resource/css/dialog.css" type="text/css" rel="stylesheet" />
<link href="/resource/css/admin/main.css" type="text/css" rel="stylesheet" />
<link href="/resource/css/admin/right.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="/resource/js/jquery.js"></script>
<script type="text/javascript" src="/resource/js/base.js"></script>
<script type="text/javascript" src="/resource/js/dialog.js"></script>
<script type="text/javascript" src="/resource/js/admin/article.js"></script>
</head>
<body>
	<div class="position"><span>您的当前位置：</span>文档管理</div>
	<form name="form_article" method="post" action="./">
    	<div class="rightbody f">
        	<div class="rightbodycontent">
                <table class="tools">
                    <tr>
                        <td>
							状态：
                            <label><input type="radio" name="stateid" value="1"<#if stateid == 1> checked</#if> onclick="getform(this).submit()"/>草稿(${state1})</label>
                            <label style="color:red;"><input type="radio" name="stateid" value="2"<#if stateid == 2> checked</#if> onclick="getform(this).submit()"/>驳回(${state2})</label>
                            <label style="color:blue;"><input type="radio" name="stateid" value="3"<#if stateid == 3> checked</#if> onclick="getform(this).submit()"/>待审(${state3})</label>
                            <label style="color:green;"><input type="radio" name="stateid" value="4"<#if stateid == 4> checked</#if> onclick="getform(this).submit()" />发布(${state4})</label>
                            &nbsp;
							标题：<input type="text" name="title" value="${title!}" style="width:200px" />&nbsp;<a onclick="getform(this).submit()" class="linkbtn search">搜索</a>
                            <#if Session.admin.adminGlobalpermission.id gt 1>
                                &nbsp;<label><input type="checkbox" name="onlyme"<#if onlyme> checked</#if> onclick="getform(this).submit()" />只看我的</label>
                            </#if>
                        </td>
                        <td align="right">
                        	<#if stateid == 1 || stateid == 4>
			    				<a href="edit?columnsid=${columnsid}&zhuantiid=${zhuantiid}&callbackparams=${urlEncode(callbackparams)}" class="linkbtn insert">新建文档</a>&nbsp;
			    			</#if>
                        	<#switch stateid>
					    		<#case 1>
	                                 <a onclick="publishselectarticle()" class="linkbtn publish">发布所选文档</a>
	                                 <a onclick="submitselectdata('remove?articleids','移除','callbackparams=${urlEncode(callbackparams)}')" class="linkbtn remove">移除所选文档</a>
					    			<#break>
					    		<#case 4>
					    			<a onclick="submitselectdata('downshelf?articleids','下架','callbackparams=${urlEncode(callbackparams)}')" class="linkbtn down">下架所选文档</a>
                                 	<#if organizations?size gt 0><a onclick="articlepush()" class="linkbtn push">报送所选文档</a></#if>
					    			<#break>
				    			<#default>
					    	</#switch>
                        </td>
                    </tr>
                </table>
                <table cellspacing="1" cellpadding="4" class="tablelist">
                    <tr>
                        <th><input type="checkbox" onclick="selectallcheckbox(this)" /></th>
                        <th>状态</th>
                        <th>管理者</th>
                        <th>标题</th>
                        <th>来源</th>
                        <th><a onclick="swtichsort('publishtime')">发布时间<#if sortfield == 'publishtime'><img src="/resource/image/admin/main/right/sort/${sortmethod}.png" /></#if></a></th>
                        <th><a onclick="swtichsort('clicknum')">点击数<#if sortfield == 'clicknum'><img src="/resource/image/admin/main/right/sort/${sortmethod}.png" /></#if></a></th>
                        <th><a onclick="swtichsort('sort')">排序<#if sortfield == 'sort'><img src="/resource/image/admin/main/right/sort/${sortmethod}.png" /></#if></a></th>
                        <th>栏目数</th>
                        <th>密保</th>
                        <th>操作</th>
                    </tr>
                    <#list articles as article>
                        <#assign articleColumns = "">
                        <#list article.articleReColumnses as arc>
							 <#assign articleColumns = articleColumns + " " + arc.columns.name>
						</#list>
						<tr<#if article_index % 2 == 1> class="splittr"</#if>>
							<td align="center"><input type="checkbox" name="ids" value="${article.id}" /></td>
                            <td align="center" style="color:<#if stateid == 2>red</#if><#if stateid == 3>blue</#if><#if stateid == 4>green</#if>">${article.articleState.name}</td>
                            <td align="center">${article.admin.name}</td>
 							<td align="center"<#if article.bold || article.red> style="<#if article.bold>font-weight:bold;</#if><#if article.red>color:red;</#if>"</#if>>${clearStringBr(article.title)}<#if article.image??> <img src="/resource/image/admin/main/right/image.png" height="13" style="vertical-align:text-bottom;" /></#if></td>
                            <td align="center">${article.source}</td>
                            <td align="center">${article.publishtime?string('yyyy-MM-dd HH:mm:ss')}</td>
                            <td align="center">${article.clicknum}</td>
                            <td align="center">${article.sort}</td>
                            <td align="center"<#if articleColumns != ""> title="${articleColumns?trim}"</#if>>${article.articleReColumnses?size}</td>
		                	<td align="center"<#if article.protection> title="密码：${article.protectionpassword!}"</#if>><img src="/resource/image/admin/main/right/ico/${article.protection?string("ok","delete")}.png" /></td>
                            <td align="center">
                                <#if stateid lt 3>
                                    <a href="edit?articleid=${article.id}&callbackparams=${urlEncode(callbackparams)}" class="linkbtn update noborder">修改</a>
                                    <a<#if article.articleReColumnses?size gt 0> onclick="publish(${article.id},0)"<#else> onclick="alert('该文档未指定发布模块，请至少指定1个发布模块')"</#if> class="linkbtn publish noborder<#if article.articleReColumnses?size == 0> gray</#if>">发布</a>
                                    <a href="remove?articleids=${article.id}&callbackparams=${urlEncode(callbackparams)}" class="linkbtn remove noborder" onclick="return confirm('确定移除该文档吗？')">移除</a>
                                </#if>
                                <#switch stateid>
						    		<#case 2>
						    			<a onclick="checkflowtrack(${article.id})" class="linkbtn search noborder">流程跟踪</a>
						    			<#break>
						    		<#case 3>
						    			<a href="detail?articleid=${article.id}" class="linkbtn detail noborder">查看</a>
	                                    <a onclick="checkflowtrack(${article.id})" class="linkbtn search noborder">流程跟踪</a>
	                                    <#if Session["admin"].account == "admin">
	                                    	<a onclick="checkflowjump(${article.id})" class="linkbtn jump noborder">流程跳转</a>
	                                    </#if>
	                                    <a<#if cancallbackarticleids?seq_contains(article.id)> href="callback?articleid=${article.id}&callbackparams=${urlEncode(callbackparams)}" onclick="return confirm('确定撤销该文档吗？')"<#else> onclick="alert('该文档已参与审核，不允许再撤销。')"</#if> class="linkbtn callback noborder<#if !cancallbackarticleids?seq_contains(article.id)> gray</#if>">撤销</a>
						    			<#break>
						    		<#case 4>
						    			<a href="detail?articleid=${article.id}" class="linkbtn detail noborder">查看</a>
	                                    <a href="downshelf?articleids=${article.id}&callbackparams=${urlEncode(callbackparams)}" class="linkbtn down noborder" onclick="return confirm('确定下架该文档吗？')">下架</a>
	                                    <#if organizations?size gt 0><a onclick="articlepushdo(${article.id})" class="linkbtn push noborder">报送</a></#if>
	                                    <a<#if article.checkflowId?? || article.checkrecords?? && article.checkrecords?size gt 0> onclick="checkflowtrack(${article.id})"<#else> onclick="alert('该文档未参与审核流程')"</#if> class="linkbtn search noborder<#if !article.checkflowId?? && (!article.checkrecords?? || article.checkrecords?size == 0)> gray</#if>">流程跟踪</a>
						    			<#break>
					    			<#default>
						    	</#switch>
                            </td>
						</tr>
                    </#list>
                </table>
                <br />
                <#include "../../include/pager.html">
                <input type="hidden" name="sortfield" id="sortfield" value="${sortfield}" />
                <input type="hidden" name="sortmethod" id="sortmethod" value="${sortmethod}" />
				<input type="hidden" name="columnsid" id="columnsid" value="${columnsid}" />
				<input type="hidden" name="zhuantiid" id="zhuantiid" value="${zhuantiid}" />
            </div>
        </div>
	</form>
	<#if stateid == 1>
    	<div id="dialog_getcheckflow" class="dialog"></div>
   	<#else>
   		<div id="dialog_checkflowjump" class="dialog"></div>
   		<div id="dialog_checkflowtrack" class="dialog"></div>
    </#if>
    <#if stateid == 4>
    	<div id="dialog_articlepush" class="dialog"></div>
    </#if>
</body>
</html>